#!/usr/bin/python
import sys
#collaborators: Sana Imam
def determineIntersectionPointOfLines(x1,y1,x2,y2,x3,y3,x4,y4):
	#Matt's find: http://en.wikipedia.org/wiki/Line%E2%80%93line_intersection
	if float((((x1-x2)*(y3-y4))-((y1-y2)*(x3-x4))))!=0:#if the denominator is zero, then the lines are parallel or coincident 
		xIntersection = float((((x1*y2)-(y1*x2))*(x3-x4))-((x1-x2)*((x3*y4)-(y3*x4))))/float((((x1-x2)*(y3-y4))-((y1-y2)*(x3-x4))))
		yIntersection = float((((x1*y2)-(y1*x2))*(y3-y4))-((y1-y2)*((x3*y4)-(y3*x4))))/float((((x1-x2)*(y3-y4))-((y1-y2)*(x3-x4))))
		return (xIntersection,yIntersection)
	else: 
		return (None,None)


def determineIfIntersectionAppliesToSegments(xIntersection,yIntersection,x1,y1,x2,y2,x3,y3,x4,y4):
	#need to check if the intersection point is actually in the span of the line segment, and also need to make sure that the the intersection point is not an endpoint
	return ((((xIntersection<x1 and xIntersection>x2) or (xIntersection>x1 and xIntersection<x2)) and ((xIntersection<x3 and xIntersection>x4) or (xIntersection>x3 and xIntersection<x4))) and ((xIntersection!=x1 and yIntersection!=y1) and (xIntersection!=x2 and yIntersection!=y2) and (xIntersection!=x3 and yIntersection!=y3) and (xIntersection!=x4 and yIntersection!=y4)))

with open(sys.argv[1], 'r') as testFile:
  firstLine = testFile.readline()
  numberOfRed = int(firstLine.split()[0])
  numberOfBlue = int(firstLine.split()[1])
  numberOfProposedCrosses = int(firstLine.split()[2])

  redLines = []
  blueLines = []

  for incrementer in range(0,numberOfRed):
  	nextLine = testFile.readline()
  	redLines.append([nextLine.split()[0],nextLine.split()[1],nextLine.split()[2],nextLine.split()[3]])

  for incrementer in range(0,numberOfBlue):
  	nextLine = testFile.readline()
  	blueLines.append([nextLine.split()[0],nextLine.split()[1],nextLine.split()[2],nextLine.split()[3]])

numberOfCrossesFound = 0
for redLine in redLines: 
	for blueLine in blueLines:
		x1=int(redLine[0])
		y1=int(redLine[1])
		x2=int(redLine[2])
		y2=int(redLine[3])
		x3=int(blueLine[0])
		y3=int(blueLine[1])
		x4=int(blueLine[2])
		y4=int(blueLine[3])
		intersectionPointOfExtendedSegments = determineIntersectionPointOfLines(x1,y1,x2,y2,x3,y3,x4,y4)
		if determineIfIntersectionAppliesToSegments(*intersectionPointOfExtendedSegments,x1=x1,y1=y1,x2=x2,y2=y2,x3=x3,y3=y3,x4=x4,y4=y4):
			numberOfCrossesFound+=1

if numberOfCrossesFound == numberOfProposedCrosses: 
	print 'VERIFIED'

